In [1]:
%matplotlib inline
%pylab inline --no-import-all
pylab.rcParams['figure.figsize'] = (18, 10)
In [2]:
from ntfdl import Dl
In [3]:
stl = Dl('STL', exchange='OSE', download=False)
In [4]:
history = stl.get_history()
In [5]:
history.tail()
Out[5]:
In [6]:
fig, ax = plt.subplots()
ax.tick_params(labeltop=False, labelright=True)
history.close.plot()
plt.grid()
# Annotate last quote
xmin, xmax = ax.get_xlim()
plt.annotate(history.iloc[-1].close, xy=(1.005, history.iloc[-1].close), xytext=(0, 0), \
xycoords=('axes fraction', 'data'), textcoords='offset points', backgroundcolor='k', color='w')
Out[6]:
In [7]:
history_ma = stl.get_history(mas=[10,20,50,100,200])
In [8]:
history_ma.tail(5)
Out[8]:
In [9]:
fig, ax = plt.subplots()
ax.tick_params(labeltop=False, labelright=True)
history_ma[['close','ma10','ma20','ma50','ma100','ma200']].plot(ax=ax)
plt.grid()
Busy chart, let's instead slice the pandas with the [from:to] syntax looking at some days of horror between 2008 and 2009.
In [10]:
fig, ax = plt.subplots()
ax.tick_params(labeltop=False, labelright=True)
history_ma['2008-01-01':'2010-01-01'][['close','ma10','ma20','ma50','ma100','ma200']].plot(ax=ax)
plt.grid()
In [11]:
history.turnover.plot()
Out[11]: